<template>
	<statusbar-item :tooltip="tooltip">
		<i class="iconfont icon-statusbar-tupian center"></i>
	</statusbar-item>
</template>

<script setup lang="ts">
import { computed } from 'vue';
import statusbarItem from '@v/components/statusbar/statusbarItem/index.vue';
import { useRootStore } from '@v/store';

const store = useRootStore();

const tooltip = computed(() => {
	if (store.isWork) {
		if (store.fileInfo && store.fileInfo.imageInfo && store.fileInfo.imageCount.total > 0) {
			let str = `共${store.fileInfo.imageCount.total}张图片;`;
			let str2 = '';

			str2 += 'url: ' + store.fileInfo.imageCount.url;
			str2 += ', absolute: ' + store.fileInfo.imageCount.absolute;
			str2 += ', relative: ' + store.fileInfo.imageCount.relative;

			if (store.fileInfo.imageCount.unknown > 0) str2 += ', 未知: ' + store.fileInfo.imageCount.unknown;

			return str + ' [' + str2 + ']';
		} else {
			return '未检测到图片';
		}
	} else {
		return '未选择文档';
	}
});
</script>
